package file.read.csvAdnVcard;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;

import au.com.bytecode.opencsv.CSVReader;

public class ReadCsv {
	
	private static String path="E:/联系人导出/gmailnew/google.csv";//UTF-16
	
	public static void main(String[] args) throws Exception{
		File file=new File(path);
		String charSet[]={"UTF-8","UTF-16","UTF-16LE","GBK","UTF-16BE","US-ASCII","ISO-8859-1"};
		CSVReader reader=new CSVReader(new InputStreamReader(new FileInputStream(file), charSet[1]));
		String[]nextLine=reader.readNext();
		int count=0;
		int len=nextLine.length;
		while( nextLine!=null ){
			count++;
			if(count==1){
				System.out.println("columnName:");
				for(int i=0;i<len;i++){
					System.out.print(nextLine[i]+"===");
				}
			}else{
				System.out.println("content:");
				for(int i=0;i<len;i++){
					System.out.print(nextLine[i]+"---");
				}
			}
			System.out.println();
			nextLine=reader.readNext();
		}
		
		System.out.println("total "+count+" record");
		System.out.println("every record have "+len+" item");
	}
	
	
}





